package com.zbf.task.job;

import com.zbf.task.service.TaskService;
import com.zbf.utils.MyDateTimeUtils;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.util.Map;

/**
 * 作者: LCG
 * 日期: 2020/1/4 11:36
 * 描述:
 */

@DisallowConcurrentExecution //不允许该任务的并发执行
public class TestJob implements Job {

    @Autowired
    private TaskService taskService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //
        JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
        //获取参数可以这么获取
        Object obj = jobDataMap.get("canshu1");
        System.out.println("==========任务Job=========="+MyDateTimeUtils.getCurrentDate()+"-------->"+obj);
        taskService.test();
        //
    }

}
